package com.x.Part5_methodDemo;


/**
 * ClassName: person
 * Package: IntelliJ IDEA
 * Description:
 * Written by HanXu
 * Create 2023/9/15 3:03
 */

//Java里的方法（函数）不能独立存在，所有的方法必须定义在类中


public class Employee {
    int age;
    String name;
    double salary;
    String id;
    MyDate birthday;

    //设置对象的属性值
    public void setAge(int age) {
        this.age = age;
    }

    //得到age
    public int getAge(){
        return age;
    }

    public void showMessage(){
        System.out.println("id = " + id + ", name = " + name +
                ", age = " + age + "岁, salary = " + salary +
                "元, birthday = " + birthday.year + "年" + birthday.month +
                "月" + birthday.day + "日");
    }

    public String interests(String hobby){
        String info = name+"的爱好是"+hobby;
        System.out.println(info);
        return  info;
    }
}


